import {List} from '../../../../mock/user/'

module.exports = {
	name: 'list',
	data() {
		return {
			userList:[],
			waterDeliverList:[],
			waterStoreList: [],
			page:1,
			size:3,
			total:4,
			currentPage:1,
			listShow:'user',
			listShowString:'普通用户', //用户列表默认显示userList
			picDialogVisible:false,
			dialogImageUrl:null,
		}
	},
	methods:{
		getList() {
			this.userList = this.formProduct(List.data.user);
			this.waterDeliverList = this.formProduct(List.data.waterDeliver);
			this.waterStoreList = this.formProduct(List.data.waterStore);
		},
		formProduct(userList) {
			return userList.map(user => {
				user.createTime = this.$$formatTime1(user.createTime);
				if(user.modifiedTime!=undefined){
					user.modifiedTime = this.$$formatTime1(user.modifiedTime);
					return user;
				}
				return user;
			})
		},
		handleCurrentChange(val) {
		    this.page = val;
		    this.getList();
		},
		//根据下拉菜单的值显示不同的用户列表
		handleCommand(command) {
			this.listShow = command;
			this.listShowString = command === 'user' ? '普通用户' : command === 'waterDeliver' ? '配送员' : '水店';
		},
		//水店外观、内部图查看大图
		waterStoreCover(picUrl) {
			this.dialogImageUrl = picUrl;
			this.picDialogVisible = true;
		},
		waterStoreDetail(picUrl) {
			this.dialogImageUrl = picUrl;
			this.picDialogVisible = true;
		},
		
	},
	created(){
		this.getList();
	},
}